define(function(require, exports, module) {
    "require:nomunge,exports:nomunge,module:nomunge";

    var view = require('mokit/view');
    var grid = require('mokit/grid');
    var utils = require('mokit/utils');
    var commonUtils = require('../common/utils');
    var app = require('mokit/app');
    var move = require('mokit/move');

    /**
     * 关于页视图
     */
    return view.create({
        template: module.resovleUri('../templates/project-new.html'),

        el: {
            addPositionPanel: '.ui-add-position-panel',
            mask: '.ui-mask',
            project_name: '.project-name',
            project_summary: '.project-summary',
            //
            position_name: '.position-name',
            position_money: '.position-money',
            position_time: '.position-time',
            position_summary: '.position-summary'
        },

        utils: commonUtils,
        config: app.config,

        /**
         * 在视图呈现时
         */
        onRender: function(context) {
            var self = this;
            self.closeAddPosition(context);
            grid.use(self.ui);
        },

        openAddPosition: function(context, disAni, callback) {
            var self = this;
            var self = this;
            var dur = disAni ? 0 : 300;
            move(self.el.addPositionPanel[0])
                .duration(dur)
                .y(0)
                .end(function() {
                    if (callback) callback();
                });
            self.el.mask.fadeIn(300);
        },

        closeAddPosition: function(context, disAni, callback) {
            var self = this;
            var dur = disAni ? 0 : 300;
            move(self.el.addPositionPanel[0])
                .duration(dur)
                .y(290)
                .end(function() {
                    if (callback) callback();
                });
            self.el.mask.fadeOut(300);
        },

        getNewPositionInfo: function(context) {
            var self = this;
            var info = {
                roleName: self.el.position_name.val(),
                remuneration: self.el.position_money.val(),
                timeLimit: self.el.position_time.val(),
                requirement: self.el.position_summary.val(),
            };
            return info;
        },

        clearPostionInput: function(context) {
            var self = this;
            self.el.position_name.val('');
            self.el.position_money.val('');
            self.el.position_time.val('');
            self.el.position_summary.val('');
        },

        getNewProjectInfo: function(context) {
            var self = this;
            return {
                projectName: self.el.project_name.val(),
                projectInfo: self.el.project_summary.val()
            }
        }
    });
});